<template>
    <div class="find-container">
            <div class="info">
                <div class="datile_head">{{ detail.title }}</div>
            <div class="datile_author">作者：{{ detail.author }}  发布时间：{{detail.createTime}}</div>
            <div v-for="image in images">
                <img  :src="image"  class="image"/>
            </div>

            <div class="detail_content" v-html="detail.content"></div> 
            </div>
    </div>
</template>
  
<script>
import { reactive, toRefs, onMounted, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import praise from '/@/assets/praise.svg'
import newRate from '/@/assets/rate.svg'
import mony from '/@/assets/mony.svg'
import mony2 from '/@/assets/mony2.svg'
import { searchArticle,get } from '/@/api/ws/article'
import { useRouter,useRoute } from 'vue-router'
export default {
    name: 'articleDetail',
    components: {
    },
    setup() {
        const router = useRouter()
        const route = useRoute()
        const state = reactive({
            detail:{}
            ,images:[]
        })

        onMounted(() => {
            get(route.query.id).then(res=>{
                state.detail = res.data
                state.images = res.data.image !=null?res.data.image.split(","):[]
            })


           
        })
        return {
           
            ...toRefs(state)
        }
    }
}
</script>
  
<style lang="scss" scoped>
.find-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction:column;
}
.image{
    height: 200px;
    object-fit: contain;
    // cursor: pointer; 
}
.datile_head{
    font-size: 25px;
    font-weight: bold;
    margin: 0px 0px 15px 0px;
}
.datile_author{
    font-size: 14px;
    color: rgb(172, 172, 172);
    margin-bottom: 20px;

}
.detail_content{
    font-size: 14px;
    font-family: -apple-system,BlinkMacSystemFont,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei","Helvetica Neue",Helvetica,Arial,sans-serif;
    font-feature-settings: "tnum";
    font-variant: tabular-nums;
}
.info{
    width:800px;
    background-color: #FFFFFF;
    border: 1px solid;
    border-radius: 15px;
    border-color: #FFFFFF;
    margin-top: 20px;
    padding: 10px 0px 10px 20px;
}
</style>